
def options(opt):
    opt.other.add_option("--nglib", action="store", type="string", metavar="NGLIB_ROOT", default="", help="Path to Netgen library.")

def configure(ctx):
    if "HAVE_GMSH" in ctx.env["DEFINES_GMSH"]:
        ctx.msg("Checking for 'nglib' header", "skipped (incompatible with GMSH)", color="YELLOW")
        return
    if ctx.link_cxx(name="nglib", header_name="cstddef nglib.h", libs=["nglib"], root=ctx.options.nglib):
        fragment = '''
        #include <cstddef>
        #define OCCGEOMETRY
        namespace nglib{
        #include "nglib.h"
        }
        using namespace nglib;
        int main(int argc, char** argv) {{ Ng_OCC_Geometry *g = Ng_OCC_Load_STEP(""); }}
        '''
        msg = "Checking for 'nglib' OCC support"
        if ctx.check_cc(fragment=fragment, msg=msg, use="NGLIB"):
            ctx.env.append_unique("DEFINES_NGLIB", "OCCGEOMETRY")